Skip to content

fix(macos): keep the primary timezone hint when the first primary has no zone - #5240

Merged
tyler-dane merged 1 commit into
mainfrom
claude/kind-dirac-bsdno0
Nov 12, 2026
Merged

tyler-dane merged 1 commit into
mainfrom
claude/kind-dirac-bsdno0

Conversation

@tyler-dane

Copy link
Copy Markdown
Contributor

Scheduled tech-debt sweep for 2026-11-12. No issue; the finding is the sweep's own.

What and why

CalendarTimeZoneHint.pick is a mirror of web pickCalendarTimeZoneHint, which its own doc comment names as the owner, and the two had drifted. Web picks the first primary calendar that actually carries a zone (find(c => c.isPrimary && c.timeZone)); Swift bound the first primary unconditionally (first(where: { $0.isPrimary })) and, when that one had no zone, let the whole if let chain fail and fell through to the generic non-UTC scan instead of trying the next primary. With two connected accounts where the first account's primary reports no timeZone and a non-primary calendar is ordered between the primaries, web resolves the second primary's zone and macOS resolved the earlier non-primary zone. timeZone is nullable in the shared calendar.contracts schema, so that state is representable, and multiple primaries are the normal multi-account shape. Nothing on either side pinned the case, so the Auto zone could disagree across platforms and land the day grid on a different day at the UTC boundary, which is the failure #5229, #5232 and #5235 were written to close, reached through the mirror instead.

The fix routes both sides of the Swift predicate through one usableZone helper so an absent or empty zone no longer consumes the primary preference, and pins the same vector on both platforms (web calendar-timezone-hint.test.ts, macOS CalendarTimeZoneHintTests.swift) so the mirror cannot drift silently again. Behavior preserving on web: the new web vector passes against the unchanged implementation, which is what identifies Swift as the drifted copy. macOS behavior changes only in the divergent case, to match the declared owner.

Examined and deliberately left alone, recorded in judged-fine.md so the next sweep does not redo it:

Verify

bun run verify --strict

Checks run: test:web, type-check, lint, knip, test:a11y, test:e2e (baseline: no new failures)
Checks skipped: (none)
Checks CI-only: test:macos:packages, test:macos (no Xcode on this machine)
VERDICT: PASS

Baseline against origin/main:

PRE-EXISTING (0): none
FLAKY, passed on rerun (2):
- test:e2e: [chromium-desktop] › e2e/accessibility/narrow-sidebar-layout.spec.ts › week sidebar fits a 360px viewport without horizontal overflow
- test:e2e: [chromium-desktop] › e2e/timed/event-form-fast-typing.spec.ts › title keeps every character when typed quickly in day view

bun cli contracts:swift --check and bun cli desktop:export --check both pass.

Note: the Swift test added here runs in CI only. There is no Xcode on the sweep machine, so test-macos.yml is what actually exercises the fixed path; the local verdict covers the web vector, types, lint, knip, a11y and e2e.


Generated by Claude Code

… no zone

`CalendarTimeZoneHint.pick` is a mirror of web `pickCalendarTimeZoneHint`,
which its own doc comment names as the owner. The two had drifted: web picks
the first primary that actually carries a zone, while Swift latched onto the
first primary unconditionally and, when that one had no zone, fell through to
the generic non-UTC scan instead of trying the next primary.

With two connected accounts where the first account's primary reports no
timeZone and a non-primary calendar is ordered between the primaries, web
resolves the second primary's zone and macOS resolved the earlier non-primary
zone. Nothing on either side pinned that case, so the Auto zone could disagree
across platforms and land the day grid on a different day at the UTC boundary,
which is the failure #5229, #5232 and #5235 were written to close.

Mirrors web's truthiness test through one `usableZone` helper, so an absent or
empty zone no longer consumes the primary preference, and pins the same vector
on both sides.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HmwVQE5bxVJUZtQKo3JX3L
@tyler-dane
tyler-dane enabled auto-merge November 12, 2026 11:34
@github-actions

Copy link
Copy Markdown
Contributor

Boot bundle: 576.8 KB gzip (+0.0 KB vs main)

@tyler-dane
tyler-dane added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 2fd32b5 Nov 12, 2026
40 checks passed
@tyler-dane
tyler-dane deleted the claude/kind-dirac-bsdno0 branch November 12, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants